using IQIGame.Onigao.Framework;
using System.Collections.Generic;

namespace IQIGame.Onigao.GamePlay
{
    public partial class LevelPlayEntityCtrl : IConditionPropFetcher, IConditionPropFetcherContainer
    {
        public int FetchConditionProp(ConditionBlackboard blackboard, int iType, IReadOnlyList<int> curValueParams)
        {
            ConditionEnviromentPropType type = (ConditionEnviromentPropType)iType;
            int singleValue;
            switch (type)
            {
                case ConditionEnviromentPropType.LevelParams:
                    levelPlayCtrl.levelParams.TryGetValue(curValueParams[0], out singleValue);
                    return singleValue;
                case ConditionEnviromentPropType.EntityExist:
                    return GetPropFetcherById(curValueParams[0]) != null ? 1 : 0;
                case ConditionEnviromentPropType.DayHour:
                    return levelPlayCtrl.curTimeHour;
                default:
                    LogGame.LogError($"关卡视图层不支持的条件类型：1 - {iType}");
                    return 0;
            }
        }

        public IConditionPropFetcher GetPropFetcherById(int id)
        {
            return GetEntityByMcid(id);
        }
    }
}
